{include file="common/header.tpl"}
<section class="main">
	<nav class="left-col">{include file="common/navi-share.tpl"}</nav>
    <article class="right-col">
    	<h2>Danh sách sự kiện{if isset($smarty.session.event) && ($smarty.session.event&1<<1) > 0} &raquo; <a href="{$smarty.const.HOST_BACKEND}event/add">Thêm mới</a>{/if}</h2>
        {include file="event/search.tpl"}
                    
        <form name="frmEvent" id="frmEvent" action="{$smarty.const.HOST_BACKEND}event/act" method="post" enctype="multipart/form-data">
            <input type="hidden" name="paction" id="paction"/>
            <input type="hidden" name="pbackurl" id="pbackurl" value="{$smarty.const.HOST_BACKEND}event/index"/>
            {if $arrResult}
                {if isset($smarty.session.event)}   
                    <div class="s-button">  
                        {if ($smarty.session.event&1<<4) > 0}
                            <button type="button" onclick="javascript:confirmPending(this.form);">Tạm dừng</button>
                        {/if}  
                        {if ($smarty.session.event&1<<5) > 0}
                            <button type="button" onclick="javascript:confirmActive(this.form);">Kích hoạt / Phục hồi</button>
                        {/if}                                                                                   
                        {if ($smarty.session.event&1<<3) > 0} 
                            <button type="button" onclick="javascript:confirmDelete(this.form);">Xóa</button>
                            {if $AppUI->type > 2}
                                <button type="button" onclick="javascript:confirmDeleteDb(this.form);">Xóa khỏi Db</button> 
                            {/if}
                        {/if}
                    </div>
                {/if}
                {if $intTotal > 0}
                    <div class="s-page">
                        <strong class="total">Tổng số {$intTotal}</strong>
                        {paging total=$intTotal limit=$intLimit offset=$intOffset url=$strUrl}
                    </div>
                {/if}                
            {/if}
            <table width="100%" cellpadding="0" cellspacing="0" border="0" class="list">
                <thead>
                    <tr>
                        {if $arrResult && isset($smarty.session.event) && ( (($smarty.session.event&1<<3)>0) || (($smarty.session.event&1<<4)>0) )}
                            <th width="16"><input type="checkbox" name="pcheckall" id="pcheckall" onclick="javascript:checkAll(this.form,'peventid[]',this.checked);"/></th>
                        {/if}    
                        <th width="200">Tên trường</th>
                        <th>Thông tin</th> 
                        <th width="150">Địa chỉ</th>
                        <th width="70">Tình trạng</th>
                        <th width="70">Ngày đăng</th>
                        {if $arrResult && isset($smarty.session.event)}
                            <th width="42">&nbsp;</th>
                        {/if}
                    </tr>
                </thead>
                <tbody>
                    {if $arrResult}
                        {foreach item=item from=$arrResult}
                            <tr class="{cycle values="odd,even"}">
                                {if isset($smarty.session.event) && ((($smarty.session.event&1<<3)>0) || (($smarty.session.event&1<<4)>0))}
                                    <td align="center">
                                        <input type="checkbox" id="peventid{$item.eventid}" name="peventid[]" value="{$item.eventid}" onclick="javascript:checkOneItem(this.form, 'pcheckall')"/>
                                    </td>
                                   
                                {/if}
                                 <td >{$item.name}</td>
                                <td>
                                    <div>
                                        <span class="firstItem">Danh mục:</span>
                                        <span>{$item.category_name}</span>
                                    </div>
                                    <div class="topLine">
                                        <span class="firstItem">Ngày bắt đầu:</span>
                                        <span>{$item.d_start|date_format:"%d/%m/%Y %H:%M"}</span>
                                    </div>
                                    <div class="topLine">
                                        <span class="firstItem">Ngày kết thúc:</span>
                                        <span>{$item.d_end|date_format:"%d/%m/%Y %H:%M"}</span>
                                    </div>
                                </td> 
                                <td>{$item.addr}, {$item.district_name}<br/>{$item.province_name}<br/>{$item.country_name}</td>
                                <td align="center">
                                    {if $item.status == 0}
                                        <img src="{$smarty.const.HOST_STATICS}backend/img/ad-unaccept.png" width="16" height="" alt="Tạm dừng" border="0" title="Tạm dừng" />
                                    {elseif $item.status == 1}
                                         <img src="{$smarty.const.HOST_STATICS}backend/img/ad-accept.png" alt="Đang kích hoạt" border="0" width="16" height="16" />
                                    {elseif $item.status == 2}
                                        <img src="{$smarty.const.HOST_STATICS}backend/img/ad-cancel.png" alt="Bị xóa" border="0" width="16" height="16" />
                                    {/if}
                                </td>
                                <td align="center">{$item.postdate|date_format:"%d/%m/%Y"}<br/>{$item.postdate|date_format:"%H:%M:%S"}</td>
                                {if isset($smarty.session.event)}
                                    <td align="center">
                                        {if ($smarty.session.event&1<<2)>0}
                                            <a href="{$smarty.const.HOST_BACKEND}event/edit?eventid={$item.eventid}" title="Cập nhật thông tin">
                                                <img src="{$smarty.const.HOST_STATICS}backend/img/ad-edit.png" alt="Edit" border="0" width="16" height="16" />
                                            </a>
                                        {/if}
                                        <a href="{$smarty.const.HOST_BACKEND}event/cmt?eventid={$item.eventid}" title="Xem bình luận" target="_blank"><img src="{$smarty.const.HOST_STATICS}backend/img/ad-comment.png" width="16" height="16" alt="" /></a>
                                    </td>
                                {/if}
                            </tr>
                        {/foreach}
                    {else}
                        <tr><td colspan="7" align="center">Không có dữ liệu</td></tr>
                    {/if}
                </tbody>
            </table>
            {if $arrResult}
            	{if $intTotal > 0}
                    <div class="s-page">
                        <strong class="total">Tổng số {$intTotal}</strong>
                        {paging total=$intTotal limit=$intLimit offset=$intOffset url=$strUrl}
                    </div>
                {/if}
                {if isset($smarty.session.event)}   
                    <div class="s-button">  
                        {if ($smarty.session.event&1<<4) > 0}
                            <button type="button" onclick="javascript:confirmPending(this.form);">Tạm dừng</button>
                        {/if}  
                        {if ($smarty.session.event&1<<5) > 0}
                            <button type="button" onclick="javascript:confirmActive(this.form);">Kích hoạt / Phục hồi</button>
                        {/if}                                                                                   
                        {if ($smarty.session.event&1<<3) > 0} 
                            <button type="button" onclick="javascript:confirmDelete(this.form);">Xóa</button>
                            {if $AppUI->type > 2}
                                <button type="button" onclick="javascript:confirmDeleteDb(this.form);">Xóa khỏi Db</button> 
                            {/if}
                        {/if}
                    </div>
                {/if}           
            {/if}
        </form>
   	</article>
</section>             
{include file="common/footer.tpl"}
                
